package sepe.chenli.unit4.jiekou;

public class PrintMessage implements IPrintMessage {
    int i=0;
    String [] message;
    public PrintMessage(){
        message=new String[3];
        putmessage("Hello World!");
        putmessage("Hello China!");
        putmessage("Hello jiangYou!");
    }
    void putmessage(String str){
        message[i++]=str;
    }

    @Override//重写
    public  void printAllMessage(){
      for(int j=0;j< message.length;j++){
          System.out.println(message[j]);
      }
    }
    @Override
    public void printLastMessage(){
        System.out.println(message[message.length-1]);
    }
    @Override
    public  void printFirstMessage(){
        System.out.println(message[0]);

    }


}
